home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Diamond Collection
/
The Diamond Collection (Software Vault)(Digital Impact).ISO
/
cdr27
/
ifits00.zip
/
IFITS.DOC
next >
Wrap
Text File
|
1995-03-06
|
12KB
|
244 lines
IFITS v0.0 - System clock check and errorlevel set utility (C) 1994
Glen Gilbert -=- Patriot BBS -=- 8:1006/0@fmlynet - 1:157/534@fidonet
─────────────────────────────────────────────────────────────────────
Usage:
IFITS -T[03:00] +T[05:00] !D[1-31] -W[1-7] =M[1] -Y[1993] /E[99] /Q
IFITS is another DOS errorlevel setting utility to be used within a
batch file process. IFITS checks the system clock and compares all
the parameters to your input and returns an errorlevel appropriate
to the comparison. In other words, under the right conditions, IFITS
will run and then exit, setting a dos errorlevel which can be picked
up within a batch process where it can be acted upon accordingly.
In case you're wondering what use such a program has, my own system
serves as a hub. The nec's system sends the mail in a series of of
small bundles. This keeps my hard drive tossing, packing and linking
for hours. Ifits allows the system to receive mail for a couple of
hours without processing it. This lets the small bundles build up, so
a lot of the mail will be done all at the same time. It's like taking
one trip to the store every couple of days instead of every time one
thing is needed. Another use is to archive, delete or move log files
on a weekly, monthly, yearly or anything in between basis. If you
moderate an echo, you can have IFITS tell MsgPost to send weekly echo
rule messages. IFITS is only limited by dos and one's imagination.
The following is a basic example of IFITS within a batch file.
@echo off
IFITS +t23:59 -t22:10 =w1 +d7 /e99
if errorlevel 99 goto ItsTime
goto ItsNotTime
:ItsTime
squish get IFITS from 1:157/534 normal
goto I'mOutOfHere
:ItsNotTime
echo I'm not supposed to do anything at this time so I'll go away!
:I'mOutOfHere
exit
What this batch file accomplishes:
1. IFITS is called
2. System clock is checked to see if_it's within the range of 10
minutes before midnight and 10 minutes after 10pm
3. System day of the week is checked to see if_it's Sunday
4. System date is checked to see if its BEFORE the 7th of the
month
5. An errorlevel of 99 will be set within the operating system if
conditions of items 2(a and b) through 4 are all met (returned
true)
Line #2 test the errorlevel condition and the batch process will
jump to the line (label) ":ItsTime" and proceed with processing
from that point. Otherwise the "goto ItsNotTime" will direct the
processing to the label ":ItsNotTime" where the "echo" statement
will print the message "I'm not supposed to do anything" etc. to
the console and "exit" the batch process.
If the :ItsTime section of the batch is executed, the program
Squish.exe will be called upon and providing both it and its
configuration file are found AND there are no halting errors, a
file request will be generated for the magic file name "IFITS",
addressed to 1:157/534 as a normal flavored attach request.
Of course IFITS isn't restricted to using a relatively complex
process such as that described above. You may not even know
what a "squish", "file request" or "magic name" refers to. The
important thing to know is that IFITS can check each component
of your system clock, compare it to the specifics on the
IFITS command line and produce a value within the dos operating
system according to the result of the comparison.
Probably the most difficult thing about using ifits will be
hooking it into your batch process. However, remembering the
+ and - identifier properties may pose a problem. Just say it
as you are creating the command line..
If it's BEFORE 5:30am [and] AFTER midnight exit with 255.
IFITS +T05:30 -T00:00 /E255
Or, you can turn it around..
IFITS /E255 -T00:00 +T05:30
.. exit with 255 if_it's AFTER midnight and BEFORE 5:30am
The designator is easily left out (T,D,W,M,Y). IFITS will let you
know when you have omitted one of them.
An important factor to know is that all conditions must be TRUE
in order for IFITS to exit with the prescribed errorlevel. In
other words, IFITS !T12:00 /E255 - if_it's NOT noon, exit with
255. It must NOT be noon for IFITS to consider the statement to
be TRUE. Each and every statement in turn must prove to be TRUE
no matter how many are used. If just one argument returns FALSE,
IFITS will exit with errorlevel 0.
Other caveats are mentioned near the end of this document.
But first, here's the descriptions of each command line token.
Parameter switches (arguments) '-', '+', '!', '=' and '/'
────────────────────────────────────────────────────────
'-' The MINUS switch translates to the word "AFTER" and can
be used with the 'T', 'M', 'D', 'W' and 'Y' functions.
'+' The PLUS switch translates to the word "BEFORE" and can
be used with the 'T', 'M', 'D', 'W' and 'Y' functions.
'!' The NOT switch translates to the word "NOT" and can be
used with the 'T', 'M', 'D', 'W' and 'Y' functions. When using
this switch, the system time is calculated in hours and minutes
only. You have a 60 second window where your input and the
system clock will match.
'=' The EQUAL switch translates to the word "EQUALS" and can
be used with the 'T', 'M', 'D', 'W' and 'Y' functions. When using
this switch, the system time is calculated in hours and minutes
only. You have a 60 second window where your input and the system
clock will match.
'/' the forward slash switch can be used with the 'E' and 'Q'
functions.
Function flags T, M, D, W, E, Q and Y
─────────────────────────────────────
'T' tells IFITS that what follows is a [T]ime parameter. 24
hour time is expected, exclusively. The program checks for that
input in the form of HH:MM or HH:MM:SS and either accepts or
rejects the parameter accordingly. Only digits are accepted
where HH, MM and SS are specified and only a colon is accepted
as a delineator between the HH, MM and optional SS parameter.
The acceptable range for HH is 00 - 23. The acceptable range
for MM and the optional SS is 00 - 59 in the form:
(switch)T[HH:MM:SS] ie +T23:59:59
NOTE: 01:00:00 = 1am 13:00:00 = 1pm etc..
'M' tells IFITS that what follows is a [M]onth parameter.
Specifically the number of the month within the year.
Acceptable range for what follows is the digit sequence 1
through 12 in the form (switch)M[1 - 12] ie =M10
NOTE: 1=Jan 2=Feb etc..
'D' tells IFITS that what follows is a [D]ate parameter.
Specifically the number of the day within a month. Acceptable
range for what follows is the digit sequence 1 through 31 in
the form (switch)D[1 - 31] ie !D21
'W' tells IFITS that what follows is a [W]eek_day parameter.
Specifically the number of the day within a week. Acceptable
range for what follows are the digits 1 through 7. "1" being
Sunday and "7" being Saturday in the form (switch)W[1 - 7]
ie =W3 ..
NOTE: 1=Sun 2=Mon 3=Tue 4=Wed 5=Thu 6=Fri 7=Sat
'Y' tells IFITS that what follows is a [Y]ear parameter.
Specifically a four digit sequence such as 1994. Acceptable
range is whatever the the system clock and dos function are
capable of reporting. Form is (switch)Y[MCDY] ie =Y1994
'E' tells IFITS that what follows is an [E]rrorlevel parameter.
Specifically a 1 to 3 digit sequence in the range of 1 - 255.
Form is /E[1 - 255] ie /E99
'Q' tells IFITS that the program is NOT to send any runtime
print to the console (screen). It is the QUIET mode.
Form is /Q ie /Quiet
IFITS can check ranges ie -D5 +D15 -M5 +M10 !M7 !M8 -T14:00 /E99
An errorlevel of 99 will be set if_it's before the 15th and after
the 5th of the month. It must also be after May and before October.
However, it can't be July or August. Finally, it must be before
2 o'clock pm.
IFITS' precision when using the ! and = identifiers is exact when
confronting day_of_week(!W, =W), day_of_month(!D, =D), month(!M, =M)
and year(!Y, =Y). However, Time is a slightly different circumstance.
It is unlikely that IFITS !T12:00:00 or IFITS =T08:00:00 will ever
produce anything but an affirmative (TRUE) condition for the !T and
nothing but a negative (FALSE) return for =T. Hitting either on the
second is highly improbable. Therefore, IFITS allows a 59 second
tolerance to the positive when using either of these identifiers with
the Time factor. IFITS !T12:00:00 will return FALSE if the system
clock is in the range of 12:00:00 - 12:00:59. The principle applies
to =T08:00:00 in regard to returning TRUE. The range to return TRUE
under this condition is 08:00:00 - 08:00:59
IFITS works within the same day when handling -T, +T parameters.
For instance, IFITS +T00:00 /E255 will always return false and
errorlevel 255 will never be produced as there can be no time
before midnight.
IFITS -T02:00 +T01:00 /E255 can never produce an errorlevel exit
as it can't be AFTER(-) 2am and BEFORE(+) 1am at the same time.
This holds true with all the - and + parameters.
Neither will IFITS -D21 +D19 /E255 as the date cannot be after the
21st and before the 19th at the same time. Just as IFITS -W7 /E255
is an impossibility.. A little thought needs to go into anything
but the simplest command line.
If you need to select several months, weekdays or dates.. Using the
"=" attributes consecutively will not work unfortunately. Where the
clock equals one day, month, date or year, it will surely return
a miss for the other. For instance IFITS =W3 =W7 /E255 will forever
fail because it obviously cannot be Tuesday and Saturday at the
same time. The same goes with the other identifiers. To achieve the
example above you would use IFITS !W1 !W2 !W4 !W5 !W6 /E255. Doing
the same with the other identifiers such as dates and time can be
lengthy or impossible. If the check list goes beyond dos' 128
character line length, you can run one or a series of IFITS checks.
In otherwords, you can chain IFITS patterns, linking them through
errorlevels until you succeed through the total checklist.
Although IFITS does considerable command checking, you can cause
the program to go berserk by loading an option with too many
characters. Such as IFITS -T12:00ABCDEFGHIJKLMNOPQRSTUVWXYZ /E255
────────────────────────────────────────────────────────────────
IFITS is free but it is not to be packaged with other software
without the author's consent. Nor may other software be packaged
with IFITS. If it is to be distributed, the archive must contain
this document (ifits.doc) and original unaltered executable.
Use IFITS at your own risk. The author takes NO responsibility
for any possible damage which could occur due to its use. If you
are skeptical about the safety of using this program and do not
wish to take precautionary measures to insure IFITS will do no
damage, then do not use it.
Acknowledgement, comments and suggestions of a constructive
nature are appreciated. Please send them to:
Glen Gilbert 8:1006/0@fmlynet
1:157/534@fidonet (216)628-4860 data/fax
Thanks to;
Chris Mann and Bob Wratz for testing IFITS before it made out
your way.